﻿using System;

using Microsoft.WowAddonStudio.Lua.AST;
using Microsoft.WowAddonStudio.Lua.Model;

namespace Microsoft.WowAddonStudio.Lua.Parser
{
    public struct LexValue
    {
        /// <summary>
        /// Gets or sets the <see cref="Node"/> value.
        /// </summary>
        public Node Node { get; set; }

        /// <summary>
        /// Gets or sets the <see cref="Identifier"/> value.
        /// </summary>
        public Identifier Identifier { get; set; }

        /// <summary>
        /// Gets or sets the <see cref="QualifiedName"/> value.
        /// </summary>
        public QualifiedName QualifiedName { get; set; }

        /// <summary>
        /// Gets or sets the text value.
        /// </summary>
        public string Text { get; set; }

        public override string ToString()
        {
            if (!String.IsNullOrEmpty(Text))
                return Text;

            if (Node != null)
                return Node.ToString();

            return String.Empty;
        }
    }
}